{extend name="admin/public/base" /}

{block name="content"}
<!-- Content Header (Page header) -->
<section class="content-header">
  <h1>
    站点信息
    <small></small>
  </h1>
  <ol class="breadcrumb">
    <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
    <li><a href="#">系统</a></li>
    <li class="active">站点信息</li>
  </ol>
</section>

<!-- Main content -->
<section class="content">

    <div class="box box-solid">
           <form method="post" id="form" action="" class="form-horizontal">
              <!-- Custom Tabs -->
              <div class="nav-tabs-custom">
                <ul class="nav nav-tabs">
                  <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">基本信息</a></li>
                  <li class=""><a href="#tab_2" data-toggle="tab" aria-expanded="false">SEO设置</a></li>
                  <li class=""><a href="#tab_3" data-toggle="tab" aria-expanded="false">注册设置</a></li>
                </ul>
                <div class="tab-content">
                  <div class="tab-pane active" id="tab_1">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">网站名称</label>
                                    <div class="col-sm-5">
                                        <input type="text" name="name" value="{$name}" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">网站域名</label>
                                    <div class="col-sm-5">
                                        <input type="text" name="domain" value="{$domain}" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">版权信息</label>
                                    <div class="col-sm-5">
                                        <textarea class="form-control" name="copyright">{$copyright}</textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">统计代码</label>
                                    <div class="col-sm-5">
                                        <textarea class="form-control" name="statistics">{$statistics}</textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">地址邮编</label>
                                    <div class="col-sm-5">
                                        <input type="text" name="address" value="{$address}" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">联系方式</label>
                                    <div class="col-sm-5">
                                        <input type="text" name="contact" value="{$contact}" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">备案号</label>
                                    <div class="col-sm-2">
                                        <input type="text" name="icp" value="{$statistics}" class="form-control">
                                    </div>
                                </div>
                  </div>
                  <!-- /.tab-pane -->
                  <div class="tab-pane" id="tab_2">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">SEO标题</label>
                                    <div class="col-sm-5">
                                        <input type="text" name="title" value="{$title}" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">SEO关键词</label>
                                    <div class="col-sm-5">
                                        <input type="text" name="keywords" value="{$keywords}" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">SEO描述</label>
                                    <div class="col-sm-5">
                                        <textarea class="form-control" name="description">{$description}</textarea>
                                    </div>
                                </div>
                  </div>
                  <!-- /.tab-pane -->
                  <div class="tab-pane" id="tab_3">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">会员注册</label>
                            <div class="col-sm-5">
                                <label class="radio-inline">
                                    <input type="radio" {eq name="register" value="0"}checked{/eq} name="register" value="0"> 开启
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" {eq name="register" value="1"}checked{/eq} name="register" value="1"> 关闭
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">注册验证</label>
                            <div class="col-sm-5">
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="register_verify" {eq name="register_verify" value="3"}checked{/eq} value="3">
                                        短信验证 (需设置系统短信)
                                    </label>
                                </div>
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="register_verify" {eq name="register_verify" value="2"}checked{/eq} value="2">
                                        邮件验证 (需设置系统发件箱)
                                    </label>
                                </div>
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="register_verify" {eq name="register_verify" value="1"}checked{/eq} value="1">
                                        后台审核
                                    </label>
                                </div>
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="register_verify" {eq name="register_verify" value="0"}checked{/eq} value="0">
                                        不验证
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">投稿</label>
                            <div class="col-sm-5">
                                <label class="radio-inline">
                                    <input type="radio" {eq name="publish" value="0"}checked{/eq} name="publish" value="0"> 开启
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" {eq name="publish" value="1"}checked{/eq} name="publish" value="1"> 关闭
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">发布评论</label>
                            <div class="col-sm-5">
                                <label class="radio-inline">
                                    <input type="radio" {eq name="comment" value="0"}checked{/eq} name="comment" value="0"> 开启
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" {eq name="comment" value="1"}checked{/eq} name="comment" value="1"> 关闭
                                </label>
                            </div>
                        </div>
                  </div>
                  <!-- /.tab-pane -->
                </div>
                <!-- /.tab-content -->
                <div class="box-footer">
                  <div class="col-sm-offset-2 col-sm-10">
                    <div class="btn-group">
                        <button class="btn btn-default btn-flat" type="reset">取消</button>
                        <button class="btn btn-primary btn-flat" id="submit" type="submit">保存</button>
                    </div>
                  </div>
                </div>
              </div>
              <!-- nav-tabs-custom -->
            </form>
        </div>
    </div>

</section>
<!-- /.content -->
{/block}

{block name="js"}

<script>

    $(function(){

        $("#form").validate({
            rules: {
                key: {
                    required: true,
                    maxlength: 150
                },
                name: {
                    required: true,
                    maxlength: 150
                }
            },
            submitHandler: function(form) {
                <!-- alert("submitted!");
                $.ajax({
                    url:"{:url('admin/system/site')}",
                    data:$(form).serialize(),
                    type:'post',
                    dataType:'json',
                    success:function(xhr){
                        if(xhr.code == 200){
                            swal({
                                title: xhr.msg,
                                text: "",
                                type: "success",
                                confirmButtonText: '确定',
                                cancelButtonText: '取消',
                            });
                        } else{
                            swal({
                                title: xhr.msg,
                                text: "",
                                type: "error",
                                confirmButtonText: '确定',
                                cancelButtonText: '取消',
                            });
                        }
                    }
                });

            }
        });

    });
</script>
{/block}